const StatisticalTableDataModel = require('../../model/StatisticalTableModel')
const db = require('../../config/db')
const {QueryTypes} = require("sequelize");


class StatisticalTableDataSer {
    async addData(addData) {
        const data = await StatisticalTableDataModel.create(addData)
        return data
    }

    async getDataPageViewCount(whereData) {
        const sql = `SELECT page_view,comment_count FROM statistical_table WHERE create_date LIKE '${whereData}%' ORDER BY create_date DESC`
        const data = await db.query(sql, {type: QueryTypes.SELECT})
        return data
    }

}

module.exports = new StatisticalTableDataSer()
